import operate from '@dfeidao/atom-nodejs/db/operate';

interface Message {
	_id: string;
	productid: string;
	formgroup_no: string;
}
export default async function atom(msg: Message, action_id: string, session_id: string, spaceid: string) {
	const systemid = '12';
	const { exec, del } = operate(action_id, session_id, systemid);

	del('auth_formgroup', { _id: msg._id, productid: msg.productid });
	// const ret = await exec();
	del('auth_formgroup_form', { formgroup_no: msg.formgroup_no, productid: msg.productid });
	// const ret2 = await exec();
	del('auth_formgroup_code', { formgroup_no: msg.formgroup_no, productid: msg.productid });
	const ret3 = await exec();
	if (ret3.code === 1) {
		return 'success';
	} else {
		return 'fail';
	}
}
